/*
 * @Author: Soulmate
 * @Date: 2023-09-14 14:29:39
 * @LastEditTime: 2024-04-16 13:53:11
 * @LastEditors: Soulmate
 * @Description:
 * @FilePath: \easy-node-admin-ui\mock\index.ts
 * 版权声明
 */
// 引入: mockjs 模块;
import * as echarts from 'echarts';
import Mock from '@/utils/mockExtend';
import { createMockData } from '@/utils/ruoyi';
import { mock } from 'node:test';
const Random = Mock.Random;

type Result = {
    code: number;
    data?: Array<any>;
    msg?: string;
};

export default [
    {
        url: '/getVersionList',
        method: 'post',
        response: ({ body: { total } }) => {
            return createMockData(
                {
                    timestamp: () => Mock.mock('@time()'),
                    content: () => `EasyNode-Admin 前后端分离项目落地${Mock.mock('@string(15)')}`
                },
                total
            );
        }
    },
    {
        url: '/getTaskList',
        method: 'post',
        response: ({ body: { total } }) => {
            return createMockData(
                {
                    taskName: () => Mock.mock('@cword(10)'),
                    levelColor: () => Mock.mock('@color()'),
                    taskStatus: () => Mock.mock('@integer(1, 3)')
                },
                total
            );
        }
    },
    {
        url: '/getProgramList',
        method: 'post',
        response: ({ body: { total } }) => {
            return createMockData(
                {
                    name: () => Mock.mock('@cword(11)'),
                    startTime: () => Mock.mock('@datetime()'),
                    endTime: () => Mock.mock('@datetime()'),
                    taskStatus: () => Mock.mock('@integer(1, 3)'),
                    progress: () => Mock.mock('@integer(45, 100)'),
                    progressColor: () => Mock.mock('@color()')
                },
                total
            );
        }
    },
    {
        url: '/getTeamList',
        method: 'post',
        response: ({ body: { total } }) => {
            return createMockData(
                {
                    avatar: () => Random.image('80x80', Random.color(), '#FFF', Mock.mock('@cword(1)')),
                    name: () => `${Mock.mock('@cword(4)')}`,
                    desc: () => Mock.mock('@cword(16)'),
                    status: () => Mock.mock('@integer(1, 0)')
                },
                total
            );
        }
    },
    {
        url: '/getPaneList',
        method: 'post',
        response: ({ body: { total } }) => {
            return createMockData(
                {
                    paneName: () => Mock.mock('@cword(10)'),
                    levelColor: () => Mock.mock('@color()'),
                    paneStatus: () => Mock.mock('@integer(1, 3)'),
                    paneNum: () => Mock.mock('@integer(5450, 30000)')
                },
                total
            ) as Result;
        }
    },
    {
        url: '/getSaleGoodInfo',
        method: 'post',
        response: ({ body: { total } }) => {
            return {
                code: 200,
                data: {
                    ...Mock.mock({
                        'seriesData|12': ['@integer(50, 150)']
                    }),
                    xAxisData: Mock.mock('@easyMonth(12)')
                }
            };
        }
    },
    {
        url: '/getComeInfo',
        method: 'post',
        response: ({ body: { total } }) => {
            return {
                code: 200,
                data: {
                    ...Mock.mock({
                        'seriesData|7': [
                            {
                                'name': "@cname",
                                type: 'line',
                                stack: 'Total',
                                smooth: true,
                                lineStyle: {
                                    width: 0
                                },
                                showSymbol: false,
                                areaStyle: {
                                    opacity: 0.8,
                                    'color': "@color",
                                },
                                emphasis: {
                                    focus: 'series'
                                },
                                'data|12': ['@integer(50, 150)']
                            }
                        ]
                    }),
                    xAxisData: Mock.mock('@easyMin(60, 5)')
                }
            };
        }
    }, {
        url: '/getWordCloud',
        method: 'post',
        response: ({ body: { total } }) => {
            return {
                code: 200,
                data: {
                    ...Mock.mock({
                        'seriesData|30': [
                            {
                                'name': "@cname(2, 3)",
                                value: "@integer(50, 30000)"
                            }
                        ]
                    })
                }
            };
        }
    }, {
        url: '/getOrderChart',
        method: 'post',
        response: ({ body: { total } }) => {
            return {
                code: 200,
                data: {
                    ...Mock.mock({
                        'seriesData|1': [
                            {
                                'name': "@cname",
                                type: 'line',
                                stack: 'Total',
                                smooth: true,
                                lineStyle: {
                                    width: 0
                                },
                                showSymbol: false,
                                areaStyle: {
                                    opacity: 0.8,
                                    'color': "@color",
                                },
                                emphasis: {
                                    focus: 'series'
                                },
                                'data|6': ['@integer(50, 150)']
                            }
                        ]
                    }),
                    xAxisData: Mock.mock('@easyMin(60, 10)')
                }
            };
        }
    }, {
        url: '/getPriceChart',
        method: 'post',
        response: ({ body: { total } }) => {
            return {
                code: 200,
                data: {
                    ...Mock.mock({
                        'seriesData|12': ['@integer(50, 150)']
                    }),
                    xAxisData: Mock.mock('@easyMonth(12)')
                }
            };
        }
    },
];
